package Entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Room{
    private String buildinglocation;
    private String floorlocation;
    private String name;
    private boolean common;
    private List<String> beds;
    private List<Boolean> full;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Room)) return false;
        Room room = (Room) o;
        return isCommon() == room.isCommon() && Objects.equals(getBuildinglocation(), room.getBuildinglocation()) && Objects.equals(getFloorlocation(), room.getFloorlocation()) && Objects.equals(getName(), room.getName()) && Objects.equals(getBeds(), room.getBeds()) && Objects.equals(getFull(), room.getFull());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getBuildinglocation(), getFloorlocation(), getName(), isCommon(), getBeds(), getFull());
    }

    @Override
    public String toString() {
        return buildinglocation + floorlocation + name;
    }

    public List<String> getisFull(){
        List<String> list = new ArrayList<>();
        for(boolean b:full){
            if(b) list.add("该床位已满");
            else list.add("空");
        }
        return list;
    }
    public Room(){}
    public Room(String buildinglocation, String floorlocation, String name, boolean common, List<String> beds, List<Boolean> full) {
        this.buildinglocation = buildinglocation;
        this.floorlocation = floorlocation;
        this.name = name;
        this.common = common;
        this.beds = beds;
        this.full = full;
    }


    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getBuildinglocation() {
        return buildinglocation;
    }
    public void setBuildinglocation(String buildinglocation) {
        this.buildinglocation = buildinglocation;
    }
    public String getFloorlocation() {
        return floorlocation;
    }
    public void setFloorlocation(String floorlocation) {
        this.floorlocation = floorlocation;
    }
    public boolean isCommon() {
        return common;
    }
    public void setCommon(boolean common) {
        this.common = common;
    }
    public List<String> getBeds() {
        return beds;
    }
    public void setBeds(List<String> beds) {
        this.beds = beds;
    }
    public List<Boolean> getFull() {
        return full;
    }
    public void setFull(List<Boolean> full) {
        this.full = full;
    }
}
